<?php
/**
 * JoiGallery - image gallery component for Joostina
 *
 * Перемещение категорий
 *
 * @version 1.0 alpha 12
 * @package JoiGallery
 * @subpackage	AdminView
 * @filename item_move.php
 * @author JoostinaTeam
 * @copyright (C) 2008-2009 Joostina Team
 * @license see license.txt
 *
 **/
 
defined('_VALID_MOS') or die();

//Загружаем FancyBox
if ($params->get('adm_cat_list_thumbs_fb')) {
mosCommonHTML::loadJqueryPlugins('fancybox/jquery.fancybox',false, true);
}

?>

<table class="adminheading">
  <tr>
    <th class="config">
     <?php echo _C_JOIGALLERY_COMPONENT._C_JOIGALLERY_MOVE_CATEGORIES; ?>
    </th>
  </tr>
</table>

<form action="index2.php?option=<?php echo $option; ?>&act=photos" method="post" name="adminForm">
  <table class="adminheading" border="1">
    <tr>
      <tr>
        <td width="140"><?php echo '<span class="gray">'._C_JOIGALLERY_PHOTO_MOVE_CAT.':</span> ' ?></td>
        <td><?php echo $lists['cid']; ?></td>
      </tr>
    </tr>
  </table>  
  <table class="adminlist">
    <tr>
      <th width="10" style="text-align: center">#</th>
      <th width="20"><input type="checkbox" name="toggle" value="" checked="checked" onClick="checkAll(<?php echo count( $rows );?>);" /></th>      
      <th class="title"><?php echo _C_JOIGALLERY_NAME ?></th>	  
      <th class="title"><?php echo _C_JOIGALLERY_CATEGORY_PARENT ?></th>
	  <?php if ($params->get('adm_img_list_thumbs')) { ?>
	    <th class="title acenter"><?php echo _C_JOIGALLERY_PHOTO_GALLERY_THUMBNAIL ?></th>
	  <?php } ?>
    </tr>

    <?php    
    $name = 'cid';
    $k = 0;
    for ($i=0, $n=count( $rows ); $i < $n; $i++) {
         $row  = &$rows[$i];
         $link = 'index2.php?option='.$option.'&amp;act=photos&amp;task=edit&amp;hidemainmenu=1&amp;cid='.$row->id;
		 $parent_id = $cat->get_cat_field_by_cid($row->id, 'parent_id');		 
		 $category_name = ($parent_id) 
		                ?  '<span class="red">'.$cat->get_cat_field_by_cid($parent_id, 'name').'</span>' 
						: _C_JOIGALLERY_CATEGORY_ROOT;
    ?>

    <tr class="row<?php echo $k; ?>">
      <td align="right"><?php echo $pageNav->rowNumber( $i ); ?></td>
      <td><?php //echo mosHTML::idBox($i, $row->id); ?>
        <?php echo '<input type="checkbox" id="cb'.$i.'"
                           name="'.$name.'[]"
                           value="'.$row->id.'"
                           checked="checked"
                           onclick="isChecked(this.checked);" />'; ?>

      </td>
            
      <td>
        <a href="<?php echo $link; ?>">
          <?php echo  $row->name ; ?>
        </a>
      </td>	  
      <td><?php echo $category_name; ?></td>
      <?php if ($params->get('adm_cat_list_thumbs')) { ?>
        <td align="center">          	  
			<?php if ($params->get('adm_cat_list_thumbs_fb')) { ?>
			  <a class="thumb" target="_blank" rel="all" href="<?php echo JPATH_SITE.$params->original_path.'/'.$cat->get_cat_default_thumb_field($row->id); ?>" title="<?php echo _C_JOIGALLERY_PHOTO_GALLERY_THUMBNAIL ?>&nbsp;::&nbsp;<?php echo $row->title; ?>">
                <?php    echo joiGalleryHelper::imgThumb ($thumb_source, $cat->get_cat_default_thumb_field($row->id), $params, 'cat_list'); ?>
			  </a>
			<?php } else echo joiGalleryHelper::imgThumb ($thumb_source, $cat->get_cat_default_thumb_field($row->id), $params, 'cat_list'); ?>          
        </td>
      <?php }//if ?> 
    </tr>

    <?php
    $k = 1 - $k;
  }//for
  ?>
  </table>
  
  <div class="adminlistfooter">
   <?php echo $pageNav->getListFooter(); ?>
  </div>

  <input type="hidden" name="option" value="<?php echo $option; ?>" />
  <input type="hidden" name="task" value="savemove" />
  <input type="hidden" name="act" value="categories" /> 
  <input type="hidden" name="hidemainmenu" value="0" />
  <input type="hidden" name="boxchecked" value="1" /> 

</form>

<script type="text/javascript">
  $("a.thumb").fancybox();
</script>